home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / SOUND / MP3CONV.ZIP / !MP3Conv / h / ieeefloat < prev    next >
Text File  |  1996-03-28  |  3KB  |  81 lines

  1. #ifndef IEEE_FLOAT_H__
  2. #define IEEE_FLOAT_H__
  3. /* Copyright (C) 1988-1991 Apple Computer, Inc.
  4.  * All Rights Reserved.
  5.  *
  6.  * Warranty Information
  7.  * Even though Apple has reviewed this software, Apple makes no warranty
  8.  * or representation, either express or implied, with respect to this
  9.  * software, its quality, accuracy, merchantability, or fitness for a 
  10.  * particular purpose.  As a result, this software is provided "as is,"
  11.  * and you, its user, are assuming the entire risk as to its quality
  12.  * and accuracy.
  13.  *
  14.  * This code may be used and freely distributed as long as it includes
  15.  * this copyright notice and the warranty information.
  16.  *
  17.  * Machine-independent I/O routines for IEEE floating-point numbers.
  18.  *
  19.  * NaN's and infinities are converted to HUGE_VAL or HUGE, which
  20.  * happens to be infinity on IEEE machines.  Unfortunately, it is
  21.  * impossible to preserve NaN's in a machine-independent way.
  22.  * Infinities are, however, preserved on IEEE machines.
  23.  *
  24.  * These routines have been tested on the following machines:
  25.  *    Apple Macintosh, MPW 3.1 C compiler
  26.  *    Apple Macintosh, THINK C compiler
  27.  *    Silicon Graphics IRIS, MIPS compiler
  28.  *    Cray X/MP and Y/MP
  29.  *    Digital Equipment VAX
  30.  *    Sequent Balance (Multiprocesor 386)
  31.  *    NeXT
  32.  *
  33.  *
  34.  * Implemented by Malcolm Slaney and Ken Turkowski.
  35.  *
  36.  * Malcolm Slaney contributions during 1988-1990 include big- and little-
  37.  * endian file I/O, conversion to and from Motorola's extended 80-bit
  38.  * floating-point format, and conversions to and from IEEE single-
  39.  * precision floating-point format.
  40.  *
  41.  * In 1991, Ken Turkowski implemented the conversions to and from
  42.  * IEEE double-precision format, added more precision to the extended
  43.  * conversions, and accommodated conversions involving +/- infinity,
  44.  * NaN's, and denormalized numbers.
  45.  *
  46.  * $Id: ieeefloat.h,v 1.1 1993/06/11 17:45:46 malcolm Exp $
  47.  *
  48.  * $Log: ieeefloat.h,v $
  49.  * Revision 1.1  1993/06/11  17:45:46  malcolm
  50.  * Initial revision
  51.  *
  52.  */
  53.  
  54. #include    <math.h>
  55.  
  56. typedef float Single;
  57.  
  58. #ifndef applec
  59.  typedef double defdouble;
  60. #else /* !applec */
  61.  typedef long double defdouble;
  62. #endif /* applec */
  63.  
  64. #ifndef THINK_C
  65.  typedef double Double;
  66. #else /* THINK_C */
  67.  typedef short double Double;
  68. #endif /* THINK_C */
  69.  
  70. #define    kFloatLength    4
  71. #define    kDoubleLength    8
  72. #define    kExtendedLength    10
  73.  
  74. extern defdouble ConvertFromIeeeSingle(char *bytes);
  75. extern void ConvertToIeeeSingle(defdouble num, char *bytes);
  76. extern defdouble ConvertFromIeeeDouble(char *bytes);
  77. extern void ConvertToIeeeDouble(defdouble num, char *bytes);
  78. extern defdouble ConvertFromIeeeExtended(char *bytes);
  79. extern void ConvertToIeeeExtended(defdouble num, char *bytes);
  80. #endif
  81.